package cn.jeeweb.modules.web.cause.service.impl;

import cn.jeeweb.core.common.service.impl.CommonServiceImpl;
import cn.jeeweb.core.query.data.Page;
import cn.jeeweb.core.query.data.PageImpl;
import cn.jeeweb.core.query.data.Pageable;
import cn.jeeweb.core.query.data.Queryable;
import cn.jeeweb.core.query.parse.QueryToWrapper;
import cn.jeeweb.modules.web.cause.content.HuCauseCompanyContent;
import cn.jeeweb.modules.web.cause.mapper.HuCauseCompanyMapper;
import cn.jeeweb.modules.web.cause.entity.HuCauseCompany;
import cn.jeeweb.modules.web.cause.service.IHuCauseCompanyService;
import cn.jeeweb.modules.web.labor.content.HuSubsidyContent;
import com.baomidou.mybatisplus.mapper.Wrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**   
 * @Title: hu_cause_company
 * @Description: hu_cause_company
 * @author rql
 * @date 2018-02-28 16:31:55
 * @version V1.0   
 *
 */
@Transactional
@Service("huCauseCompanyService")
public class HuCauseCompanyServiceImpl  extends CommonServiceImpl<HuCauseCompanyMapper,HuCauseCompany> implements  IHuCauseCompanyService {


    @Resource
    private HuCauseCompanyMapper huCauseCompanyMapper;


    public Page<HuCauseCompanyContent> selectSubsidyPage(Queryable queryable, Wrapper<HuCauseCompanyContent> wrapper){
        QueryToWrapper<HuCauseCompanyContent> queryToWrapper = new QueryToWrapper<HuCauseCompanyContent>();
        queryToWrapper.parseCondition(wrapper, queryable);
        // 排序问题
        queryToWrapper.parseSort(wrapper, queryable);
        Pageable pageable = queryable.getPageable();
        com.baomidou.mybatisplus.plugins.Page<HuCauseCompanyContent> content = new com.baomidou.mybatisplus.plugins.Page<HuCauseCompanyContent>(
                pageable.getPageNumber(), pageable.getPageSize());
        List<HuCauseCompanyContent> list=huCauseCompanyMapper.selectAllList(content);
        content.setRecords(list);
        return new PageImpl<HuCauseCompanyContent>(content.getRecords(), queryable.getPageable(), content.getTotal());
    }

}
